import java.util.Scanner;

public class MenuDrivenProgram{
   public static void main(String[] args){
      int num1, num2, result, choice;
      Scanner kbScanner = new Scanner(System.in);
      do{
   	   System.out.println("1. Addition");
         System.out.println("2. Subtraction");
         System.out.println("3. Multiplication");
         System.out.println("4. Exit");

         System.out.print("Please select your choice: ");
         choice = kbScanner.nextInt();

	      if(choice >= 1 && choice <= 3){
		      System.out.print("Enter two integers: ");
              num1 = kbScanner.nextInt();
              num2 = kbScanner.nextInt();

		      switch(choice){
			      case 1: System.out.printf("%d + %d = %d%n", num1, num2, num1+ num2);
			              break;
			      case 2: System.out.printf("%d - %d = %d%n", num1, num2, num1- num2);
			              break;
			      case 3: System.out.printf("%d * %d = %d%n", num1, num2, num1* num2);
			              break;

		          }
	        }else if(choice != 4)
	              System.out.println("Error: Invalid choice");

            kbScanner.nextLine(); // clear the input buffer
	        if(choice != 4){
	           System.out.println("Press any key to continue . . .");
	           kbScanner.nextLine();  // read the key press
		    }
      }while(choice != 4);
   }
}